#ifndef SHAREMANAGER_H
#define SHAREMANAGER_H

#include <cstring>

#include <windows.h>

#include "Share.h"
#include "crc32c.h"
#include "ShareTransport.h"
#include "ClipboardShareWindow.h"
#include "ShareRecvProcess.h"
#include "VirtFoldersMgr.h"

class ShareMgr {
public:
    ShareMgr();
    ~ShareMgr();
    DWORD InitShareMgrWindow();
    DWORD InitShareMgrConfig();
    HANDLE GetWaitHandle();
    void DevChangeNotify(WPARAM wParam, LPARAM lParam);

private:
    static DWORD WINAPI ShareListenThread(ShareMgr* ptr);
    void ShareListenProc();
    BOOL SetShareRecv(ShareRecvProcess& recvProcess);
    DWORD PutToClipboard(DWORD format, PBYTE data, size_t len);
    void FetchAndSendClipboardData();
    std::string UpdateFileShares(FileShareList& fileShares);
    void Destroy();
    void SendShareName(const char* shareName, DWORD format);
    void CloseListenThread();
    void HandleVioSerialPortCreateEvent(LPARAM lParam);
    void HandleVioSerialPortChangeEvent(LPARAM lParam);
    BOOL m_bInitShareMgrWindow;
    BOOL m_bInitShareMgrConfig;
    HANDLE m_hListenThread;
    DWORD m_clipSeqNum;
    ClipboardShareWindow m_cbsWindow;
    ShareTransport m_trans;
    VirtFoldersMgr m_virtFoldersMgr;
};

#endif // SHAREMANAGER_H
